import VueRouter from "vue-router";
import Vue from "vue";
import baseRoute from "./base";
import schoolRoute from "./school";
import edRoute from "./ed/";
import dfRoute from "./df/"
import adminRoute from "./admin";

Vue.use(VueRouter);

const Login = ()=> import("../pages/login/Login");

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalReplace = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalReplace.call(this, location).catch(err => err);
};

const routes = [];

routes.push(...baseRoute);
routes.push(...schoolRoute);
routes.push(...edRoute);
routes.push(...dfRoute);
routes.push(...adminRoute);
routes.push({
    path: "/login",
    component: Login
});
const router  = new VueRouter({
    routes
});

export default router;
